package homework.mission1;

import java.util.Scanner;

public class CountDay {
    public static void main(String[] args) {
        /**
         * 获取用户输入的年月日信息，格式: xxx/xx/xx
         * 并且由此获取到年月日
         */
        System.out.println("请输入年月日, 格式: xxxx/xx/xx");
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String[] date_str = str.split("/");
        int year = Integer.parseInt(date_str[0]);
        int month = Integer.parseInt(date_str[1]);
        int days = Integer.parseInt(date_str[2]);

//        System.out.println(year + "---" + month + "---" + days);

        /**
         * 判断是平年还是闰年并由此分别计算
         */
        int[] month_arr = {31,28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        if(year % 4 == 0) {
            month_arr[1] = 29;
        }

        int count_day = 0;
        for (int i = 1; i < month; i++) {
            count_day += month_arr[i];
        }
        count_day += days;

        System.out.println("今天是 " + year + " 的第 " + count_day + "天");
    }
}
